﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using ANGFLib;

namespace ANGF
{
    public partial class UserControlSuperTalkEditor : UserControl
    {
        private MyXmlDoc doc;
        public UserControlSuperTalkEditor()
        {
            InitializeComponent();
        }
        public void SetMyXmlDoc(MyXmlDoc doc)
        {
            this.doc = doc;
        }
        public override string Text
        {
            get { return this.textBoxMain.Text; }
            set { this.textBoxMain.Text = value.Replace("\n","\r\n"); }
        }

        private void 一時話者TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new FormEditTempTalker();
            var result = form.ShowDialog(this);
            if (result != DialogResult.OK) return;
            textBoxMain.Paste(form.GetResultText());
        }

        private void 恒久話者TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new FormEditPermaTalker(doc);
            var result = form.ShowDialog(this);
            if (result != DialogResult.OK) return;
            textBoxMain.Paste(form.GetResultText());

        }

        private void コレクション追加CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new FormEditCollectionItem(textBoxMain.Text);
            var result = form.ShowDialog(this);
            if (result != DialogResult.OK) return;
            textBoxMain.Paste(form.GetResultText());
        }

        private void コレクショングループ追加GToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new FormEditCollectionGroup();
            var result = form.ShowDialog(this);
            if (result != DialogResult.OK) return;
            textBoxMain.Paste(form.GetResultText());
        }

        private void コレクションのプレイバック終了マーク挿入EToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBoxMain.Paste("#CE\r\n");
        }

        private void cコードブロックの挿入CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new FormEditCss();
            var result = form.ShowDialog(this);
            if (result != DialogResult.OK) return;
            textBoxMain.Paste(form.GetResultText());
        }

        private void 実行打ち切りの挿入TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBoxMain.Paste("#E\r\n");
        }
    }
}
